import { createRouter, createWebHistory } from 'vue-router'

export const options = [{ path: '/', name: 'HomePage', title: '综合首页', icon: 'CarOutlined' }]
const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/Login',
      component: () => import('@/views/LoginPage/LoginPage.vue')
    },
    {
      path: '/',
      component: () => import('@/components/Layout/SystemLayout.vue'),
      name: 'layout',
      children: [
        ...options.map((item) => ({
          path: item.path,
          name: item.title,
          meta: {
            title: item.title,
            icon: item.icon
          },
          component: () => import(`@/views/${item.name}/${item.name}.vue`)
        })),
        {
          path: '/404',
          name: '404',
          meta: {
            title: '404'
          },
          component: () => import('@/views/ErrorPage/404.vue')
        }
      ]
    }
  ]
})

export default router
